gdk: fix crash if visual is NULL
authorIgnacio Casal Quinteiro <icq@gnome.org>
Fri, 17 Jul 2015 07:31:32 +0000 (09:31 +0200)
committerIgnacio Casal Quinteiro <icq@gnome.org>
Fri, 17 Jul 2015 12:26:11 +0000 (14:26 +0200)
cairo_xlib_surface_get_visual might return NULL so we need to
check for NULL before trying to use it.

https://bugzilla.gnome.org/show_bug.cgi?id=752520

gdk/x11/gdkglcontext-x11.c

index c86cbd5a690e7368546c90224cd948fad1a816a8..139fae6b97b62981f2b590ab31329754b1cecc78 100644 (file)
@@ -326,6 +326,9 @@ glx_pixmap_get (cairo_surface_t *surface, guint texture_target)
     None
   };
 
+  if (visual == NULL)
+    return NULL;
+
   with_alpha = cairo_surface_get_content (surface) == CAIRO_CONTENT_COLOR_ALPHA;
 
   y_inverted = FALSE;